home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 6 / CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso / cucd / prog / mui / muirexx2.2 / demos / muidir / muidir.rexx < prev    next >
OS/2 REXX Batch file  |  1996-08-06  |  12KB  |  272 lines

  1. /*
  2.  
  3. Code:       muidir.rexx
  4. Author:     Russell Leighton
  5. Revision:   11 Jan 1996
  6.  
  7. Comments:  This is the main script for a simple directory utility that uses
  8. MUIRexx.  This scripts only function is to create the GUI for the directory
  9. utility.  Once setup the script exits.
  10.  
  11. */
  12.  
  13. options results
  14. arg portname
  15.  
  16. /* Method TAG ID definitions */
  17.  
  18. Application_OpenConfigWindow = 0x804299ba /*    { ULONG MethodID; ULONG flags; }; */
  19.  
  20. /* TAG ID definitions */
  21.  
  22. Draggable = '0x80420b6e'
  23. Dirlist_RejectIcons = '0x80424808'
  24. List_Format =                     0x80423c0a /* V4  isg STRPTR            */
  25. Listview_DragType = '0x80425cd3'
  26. Listview_MultiSelect = '0x80427e08'
  27. Menuitem_Title = '0x804218be'
  28. Weight = '0x80421d1f'
  29. ShowMe = '0x80429ba8'
  30.  
  31. /* TAG variable definitions */
  32.  
  33. TRUE = 1
  34. FALSE = 0
  35. Listview_DragType_None = 0
  36. Listview_DragType_Immediate = 1
  37. Listview_MultiSelect_Shifted = 2
  38.  
  39. if ~show('l', "rexxsupport.library") then do
  40.     call addlib('rexxsupport.library',0,-30,0)
  41. end
  42.  
  43. if ~show('l', "datatypes.library") then do
  44.     call addlib('datatypes.library',0,-30,0)
  45. end
  46.  
  47. address command 'assign muidir: MUIRexx:demos/MUIDir'
  48.  
  49. call pragma('Directory','muidir:')
  50.  
  51. if portname = '' then do
  52.     portname = 'MUIDIR'
  53.     closecom = '"quit"'
  54. end
  55. else closecom = '"window ID MDIR CLOSE"'
  56.  
  57. address VALUE portname
  58.  
  59. request TITLE '"About MUIDir"' GADGETS '"OK"' FILE '"muidir:about.txt"'
  60.  
  61. setvar screen '"Workbench"'
  62.  
  63. /* begin window definition.  A command to close the window will be issued
  64. to the port MUIREXX if the user hits the close gadget */
  65.  
  66. window ID MDIR TITLE '"Directory Utility"' COMMAND closecom PORT portname
  67.     menu LABEL '"Project"'
  68.         item COMMAND '"request TITLE About GADGETS OK FILE muidir:about.txt"' PORT portname LABEL '"About"'
  69.         menu LABEL '"Settings"'
  70.             item COMMAND '"method 'Application_OpenConfigWindow'"' PORT portname LABEL '"MUI..."'
  71.         endmenu
  72.         item ATTRS Menuitem_Title '-1'
  73.         item COMMAND '"window ID MDIR CLOSE"' PORT portname LABEL '"Close"'
  74.     endmenu
  75.  
  76.     /* begin a vertical group */
  77.  
  78.     group
  79.  
  80.         /* begin a register group */
  81.  
  82.         group ID REG REGISTER LABELS '"Directory,Buffers,Volumes,Mirror"'
  83.  
  84.             /* begin a vertical group */
  85.  
  86.             group
  87.                 group ID DIR REGISTER LABELS '"1,2"'
  88.  
  89.                     /* begin a vertical group */
  90.  
  91.                     group
  92.  
  93.                         /* create a text gadget which if hit will issue
  94.                            the command "muidir:comm DIR [/]" to REXX
  95.                            (i.e. execute a REXX macro). This command changes
  96.                            the current directory to the parent directory */
  97.  
  98.                         text ID TXT1 COMMAND '"muidir:comm 'portname' DIR [/]"' NODE '"TXT"' LABEL 'No Directory'
  99.                         group HORIZ
  100.  
  101.                             /* create a dirlist with 5 fields, no .info
  102.                                display, and which will issue a command if an
  103.                                entry is selected (by double clicking on it) */
  104.  
  105.                             dirlist ID DIR1 COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"DIR"' ATTRS Listview_DragType Listview_DragType_Immediate Listview_MultiSelect Listview_MultiSelect_Shifted Dirlist_RejectIcons TRUE List_Format '",,,,"'
  106.                             group ID G1 COMMAND '"muidir:comm 'portname' ICON [%s]"' ATTRS Weight 0 ShowMe FALSE
  107.                                 space
  108.                                 group ID GRP1
  109.                                     space HORIZ 20
  110.                                     button ID IMG1 NODE '"IMG"' ATTRS Draggable TRUE
  111.                                 endgroup
  112.                                 space
  113.                             endgroup
  114.                         endgroup
  115.                         group HORIZ
  116.  
  117.                             /* create a check gadget with weight 0 (it will
  118.                                never get sized even if the window is resized)
  119.                                and which will issue a command to port MUIREXX.
  120.                                If the check is unselected then the "%s" will be
  121.                                replaced by "1" else it will be "0".  This
  122.                                will set the attribute Dirlist_RejectIcons
  123.                                (id 0x80424808) to either true or false. */
  124.  
  125.                             check ID ICN1 ATTRS Weight 0 COMMAND '"dirlist ID DIR1 REREAD ATTRS 'Dirlist_RejectIcons' %s"' PORT portname STRINGS '"1,0"' NODE '"ICN"'
  126.  
  127.                             /* create a string gadget which will issue a
  128.                                command if a string is entered (i.e. the user
  129.                                hits the return) */
  130.  
  131.                             string ID SRC1 COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"SRC"'
  132.  
  133.                             check ATTRS Weight 0 COMMAND '"group ID G1 ATTRS 'ShowMe' %s"' PORT portname STRINGS '"0,1"' NODE '"CHK"'
  134.                         endgroup
  135.                     endgroup
  136.                     group   /* begin a vertical group */
  137.  
  138.                         /* create a text gadget which if hit will issue
  139.                            the command "muidir:comm DIR [/]" to REXX
  140.                            (i.e. execute a REXX macro). This command changes
  141.                            the current directory to the parent directory */
  142.  
  143.                         text ID TXT2 COMMAND '"muidir:comm 'portname' DIR [/]"' NODE '"TXT"' LABEL 'No Directory'
  144.                         group HORIZ
  145.  
  146.                             /* create a dirlist with 5 fields, no .info
  147.                                display, and which will issue a command if an
  148.                                entry is selected (by double clicking on it) */
  149.  
  150.                             dirlist ID DIR2 COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"DIR"' ATTRS Listview_DragType Listview_DragType_Immediate Listview_MultiSelect Listview_MultiSelect_Shifted Dirlist_RejectIcons TRUE List_Format '",,,,"'
  151.                             group ID G2 COMMAND '"muidir:comm 'portname' ICON [%s]"' ATTRS Weight 0 ShowMe FALSE
  152.                                 space
  153.                                 group ID GRP2
  154.                                     space HORIZ 20
  155.                                     button ID IMG2 NODE '"IMG"' ATTRS Draggable TRUE
  156.                                 endgroup
  157.                                 space
  158.                             endgroup
  159.                         endgroup
  160.                         group HORIZ
  161.  
  162.                             /* create a check gadget with weight 0 (it will
  163.                                never get sized even if the window is resized)
  164.                                and which will issue a command to port MUIREXX.
  165.                                If the check is unselected then the "%s" will be
  166.                                replaced by "1" else it will be "0".  This
  167.                                will set the attribute Dirlist_RejectIcons
  168.                                (id 0x80424808) to either true or false. */
  169.  
  170.                             check ID ICN2 ATTRS Weight 0 COMMAND '"dirlist ID DIR2 REREAD ATTRS 'Dirlist_RejectIcons' %s"' PORT portname STRINGS '"1,0"' NODE '"ICN"'
  171.  
  172.                             /* create a string gadget which will issue a
  173.                                command if a string is entered (i.e. the user
  174.                                hits the return) */
  175.  
  176.                             string ID SRC2 COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"SRC"'
  177.  
  178.                             check ATTRS Weight 0 COMMAND '"group ID G2 ATTRS 'ShowMe' %s"' PORT portname STRINGS '"0,1"' NODE '"CHK"'
  179.                         endgroup
  180.                     endgroup
  181.                 endgroup
  182.                 group FRAME
  183.                     group HORIZ
  184.  
  185.                         /* create a series of buttons (arranged
  186.                            horizontally) which if hit will issue commands
  187.                            to REXX (i.e. execute REXX macros) */
  188.  
  189.                         button COMMAND '"muidir:comm 'portname' COPY"' NODE '"COPY"' LABEL 'Copy'
  190.                         button COMMAND '"muidir:comm 'portname' MOVE"' NODE '"MOVE"' LABEL 'Move'
  191.                         button COMMAND '"muidir:renfile 'portname'"' NODE '"RENAME"' LABEL 'Rename'
  192.                         button COMMAND '"muidir:comm 'portname' DELETE"' NODE '"DELETE"' LABEL 'Delete'
  193.                         button COMMAND '"muidir:protfile 'portname'"' NODE '"PROTECT"' LABEL 'Protect'
  194.                     endgroup
  195.                 endgroup
  196.             endgroup
  197.             group
  198.                 group REGISTER LABELS '"Path,Command"'
  199.  
  200.                     /* create a list to hold the directory history
  201.                        buffer. If an entry in this list is selected
  202.                        then the command to change the directory will be
  203.                        issued */
  204.  
  205.                     list ID LST COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"LST"'
  206.                     group
  207.  
  208.                         /* create a list to hold the command history
  209.                            buffer. */
  210.  
  211.                         list ID HST NODE '"HST"'
  212.                         group HORIZ
  213.                             button COMMAND '"muidir:comm 'portname' HCLEAR"' NODE '"HCLEAR"' LABEL 'Clear'
  214.                             button COMMAND '"list ID HST TOGGLE"' PORT portname NODE '"TOGGLE"' LABEL 'Toggle'
  215.                             button COMMAND '"muidir:comm 'portname' HEXE"' NODE '"HEXE"' LABEL 'Execute'
  216.                         endgroup
  217.                     endgroup
  218.                 endgroup
  219.             endgroup
  220.             group
  221.  
  222.                 /* create a volumelist.  If an entry in this list
  223.                    is selected then the command to change the
  224.                    directory will be issued */
  225.  
  226.                 volumelist COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"VOL"'
  227.             endgroup
  228.             group ID MIRR REGISTER LABELS '"Copy,Delete"'
  229.                 group
  230.  
  231.                     /* create a list to display files to be copied. */
  232.  
  233.                     list ID CLST NODE '"CLST"' ATTRS Listview_MultiSelect Listview_MultiSelect_Shifted 
  234.                     group HORIZ
  235.  
  236.                         /* create a series of buttons (arranged
  237.                            horizontally) which if hit will issue commands
  238.                            to REXX (i.e. execute REXX macros) */
  239.  
  240.                         button COMMAND '"muidir:comm 'portname' CCOPY"' NODE '"CCOPY"' LABEL 'Compile'
  241.                         button COMMAND '"list ID CLST TOGGLE"' PORT portname NODE '"TOGGLE"' LABEL 'Toggle'
  242.                         button COMMAND '"muidir:comm 'portname' MCOPY"' NODE '"MCOPY"' LABEL 'Copy'
  243.                     endgroup
  244.                 endgroup
  245.                 group
  246.  
  247.                     /* create a list to display files to be deleted. */
  248.  
  249.                     list ID DLST NODE '"DLST"' ATTRS Listview_MultiSelect Listview_MultiSelect_Shifted 
  250.                     group HORIZ
  251.  
  252.                         /* create a series of buttons (arranged
  253.                            horizontally) which if hit will issue commands
  254.                            to REXX (i.e. execute REXX macros) */
  255.  
  256.                         button COMMAND '"muidir:comm 'portname' CDEL"' NODE '"CDEL"' LABEL 'Compile'
  257.                         button COMMAND '"list ID DLST TOGGLE"' PORT portname NODE '"TOGGLE"' LABEL 'Toggle'
  258.                         button COMMAND '"muidir:comm 'portname' MDEL"' NODE '"MDEL"' LABEL 'Delete'
  259.                     endgroup
  260.                 endgroup
  261.             endgroup
  262.         endgroup
  263.     endgroup
  264. endwindow
  265.  
  266. dirlist ID DIR1 APP COMMAND '"muidir:comm 'portname' DIR [%s]"'
  267. dirlist ID DIR2 APP COMMAND '"muidir:comm 'portname' DIR [%s]"'
  268.  
  269. /* all finished */
  270.  
  271. exit
  272.